/* DListNode.java */

package berkeley.homework4.list;

/**
 *  A DListNode is a node in a DList (doubly-linked list).
 */

public class DListNode {

  /**
   *  item references the item stored in the current node.
   *  prev references the previous node in the DList.
   *  next references the next node in the DList.
   *
   *  DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS.
   */

  public Object item;
  protected DListNode prev;
  protected DListNode next;
  protected boolean locked;

  /**
   *  DListNode() constructor.
   *  @param i the item to store in the node.
   *  @param p the node previous to this node.
   *  @param n the node following this node.
   */
  DListNode(Object i, DListNode p, DListNode n) {
    item = i;
    prev = p;
    next = n;
  }
  
  DListNode(Object i, DListNode p, DListNode n, boolean l) {
    item = i;
    prev = p;
    next = n;
    locked = l;
  }
  
  DListNode() {
    item = 0;
    prev = null;
    next = null;
    locked = false;
  }
  
  public boolean isLocked() {
      return locked;
  }
}